@isTest
private class AutoNumberHelperTest {
	
	static testMethod void testAccountAgencyIDNumbering() {
		
		List<Account> accounts = new List<Account>();
		for(integer i=0; i < 100; i++)
			accounts.add(new Account());
			
		Test.startTest();
			
		AutoNumberHelper agencyAutoNumber = new AutoNumberHelper(AutoNumberHelper.AutoNumberType.AccountAgencyID);
		
		for(Account a: accounts){
			agencyAutoNumber.PrepareAutoNumber(a);
		}
		
		agencyAutoNumber.Populate();
		Test.stopTest();
		
		Set<string> uniqueID = new Set<string>();
		for(Account a: accounts){
			System.debug('Agency ID is: ' + a.Agency_ID__c);
			System.assertNotEquals(null, a.Agency_ID__c, 'Agency ID should not be null');
			System.assert(!uniqueID.contains(a.Agency_ID__c), 'Agency ID should be unique.');			
			uniqueID.add(a.Agency_ID__c);
		}
		
	}

	static testMethod void testAccountMasterClientIDNumbering() {
		
		List<Account> accounts = new List<Account>();
		for(integer i=0; i < 100; i++)
			accounts.add(new Account());
			
		Test.startTest();
			
		AutoNumberHelper agencyAutoNumber = new AutoNumberHelper(AutoNumberHelper.AutoNumberType.AccountMasterClientID);
		
		for(Account a: accounts){
			agencyAutoNumber.PrepareAutoNumber(a);
		}
		
		agencyAutoNumber.Populate();
		Test.stopTest();
		
		Set<string> uniqueID = new Set<string>();
		for(Account a: accounts){
			System.debug('Master Client ID is: ' + a.Master_Client_ID__c);
			System.assertNotEquals(null, a.Master_Client_ID__c, 'Master Client ID should not be null');
			System.assert(!uniqueID.contains(a.Master_Client_ID__c), 'Master Client ID should be unique.');			
			uniqueID.add(a.Master_Client_ID__c);
		}
		
	}
	
	static testMethod void testEmptyAutoNumbering() {
		
		List<Account> accounts = new List<Account>();
		
		Test.startTest();
			
		AutoNumberHelper agencyAutoNumber = new AutoNumberHelper(AutoNumberHelper.AutoNumberType.AccountMasterClientID);
		agencyAutoNumber.Populate();
		Test.stopTest();
				
	}
	
}